<html>
<head>
  <title>test Ws mqtt.js</title>
   <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>
<input class="content"></input><button id="say">Say hello</button>
<script>
$(function() {
    var socket = new WebSocket('ws://localhost:8080/websocket'); // you add a ws:// url here
    socket.onopen = function() {
        console.log("connected...");
        socket.onmessage = function(event) {
            console.log('Client received a message:', event.data)
        }
    }

    $("#say").on("click", function(){
        socket.send("hello!");
    })
})

</script> 
</body>
</html>